/**
 * 
 */
package lu.med.praxiswahl.wahlumed.client.wclient;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 * @author PatrickPierre
 * 
 */
public class LoginPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1091918402329429519L;

	private ImageIcon backgroundImage;

	public LoginPanel() {

		super();
		this.setLayout(new BorderLayout());
		this.backgroundImage = new ImageIcon(
				(getClass().getResource("/logo_53.png")));
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		g.drawImage(backgroundImage.getImage(), 0, 0, getWidth(), getHeight(),
				this);
	}

	@Override
	public Dimension getPreferredSize() {
		Dimension size = super.getPreferredSize();
		size.width = Math.max(backgroundImage.getIconWidth(), size.width);
		size.height = Math.max(backgroundImage.getIconHeight(), size.height);

		return size;
	}

}
